#include "Graphics.h"
#include "ReportError.h"

Graphics::Graphics()
{
	m_D3D = 0;
}

Graphics::Graphics(const Graphics& other)
{
}

Graphics::~Graphics()
{
}

bool Graphics::Initialize(int ScreenWidth, int ScreenHeight, HWND hwnd)
{
	// Create the Direct3D object
	m_D3D = new D3DObj;
	if(!m_D3D)
	{
		return false;
	}

	// Initialize Direct3D
	if(!m_D3D->Initialize(ScreenWidth, ScreenHeight, VSYNC_ENABLED, hwnd, FULL_SCREEN, SCREEN_DEPTH, SCREEN_NEAR))
	{
		//MessageBox(hwnd, "Could not initialize Direct3D", "Error", MB_OK);
		ReportError("Could not initialize Direct3D");
		return false;
	}
	return true;
}

void Graphics::Shutdown()
{
	if(m_D3D)
	{
		m_D3D->Shutdown();
		delete m_D3D;
		m_D3D = 0;
	}
	return;
}

bool Graphics::Frame()
{
	// Render the graphics scene.
	return Render();
}

bool Graphics::Render()
{
	// Clear the buffers to begin the scene.
	m_D3D->BeginScene(0.0f, 1.0f, 0.0f, 1.0f);

	//Draw Here

	m_D3D->EndScene();

	return true;
}